package com.guanyong.dao;

import com.guanyong.model.VideoTodayModel;
import com.guanyong.model.VideoTopLogModel;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.List;

/**
 * Created by mxk on 2017/5/26.
 * 视频购买日志
 *
 */
public interface IVideoTodayDaoMapper {


    @Update("update t_ad_videotoday set f_intime=#{record.fIntime} where f_id=#{record.fId}")
    Integer up(@Param(value = "record") VideoTodayModel record);
    @Update("update t_ad_videotoday set f_order=f_order+1 where f_id=#{id}")
    Integer down(@Param(value = "id") Integer id);

    Integer insert(@Param(value = "record") VideoTodayModel record);

    List<VideoTodayModel> SelectVideoTodayList(@Param("classType") Integer classType,
                                                 @Param("offset") Integer offset,
                                                 @Param("limit") Integer limit);

    Integer SelectVideoTodayListCount(@Param("classType") Integer classType);

    VideoTodayModel getByIdVideoToday(@Param("id") Integer id);

    VideoTodayModel getByOrderVideoTopLog(@Param("order") Integer order,
                                           @Param("classType") Integer classType);

    @Select("select count(*) from t_ad_videotoplog")
    Integer getCount();

    @Select("select count(*) from t_ad_videotoday where f_objectid=#{objectid}")
    Integer getobjectidCount(String objectid);


    @Delete("delete from  t_ad_videotoday where f_id=#{id}")
    Integer del(Integer id);

    @Update("update t_ad_videotoday set f_order=f_order-1 where f_order>#{order} and f_classtype=#{classType}")
    Integer ups(@Param(value = "order") Integer order, @Param(value = "classType") Integer classType);
}
